// ValuSet.cpp : implementation file
//

#include "stdafx.h"
#include "utility.h"
#include "ValuSet.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CValuSet dialog


CValuSet::CValuSet(CWnd* pParent /*=NULL*/)
	: CDialog(CValuSet::IDD, pParent)
{
	//{{AFX_DATA_INIT(CValuSet)
	m_vsel = 0;
	m_lax = 0.0;
	m_af = 0.0;
	m_l0 = 0.0;
	//}}AFX_DATA_INIT
	m_ed4flg=FALSE;
}


void CValuSet::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CValuSet)
	DDX_Control(pDX, IDC_EDIT4, m_ed4);
	DDX_Control(pDX, IDC_EDIT2, m_ed2);
	DDX_Control(pDX, IDC_EDIT1, m_ed1);
	DDX_Radio(pDX, IDC_RADIO1, m_vsel);
	DDX_Text(pDX, IDC_EDIT1, m_lax);
	DDX_Text(pDX, IDC_EDIT2, m_af);
	DDX_Text(pDX, IDC_EDIT4, m_l0);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CValuSet, CDialog)
	//{{AFX_MSG_MAP(CValuSet)
	ON_BN_CLICKED(IDC_RADIO4, OnRadio4)
	ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
	ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
	ON_BN_CLICKED(IDC_RADIO3, OnRadio3)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CValuSet message handlers

BOOL CValuSet::OnInitDialog() 
{
	CDialog::OnInitDialog();

	m_ed1.EnableWindow(FALSE);
	m_ed2.EnableWindow(FALSE);

	if(m_vsel==3)
	{
		m_ed1.EnableWindow(TRUE);
		m_ed2.EnableWindow(TRUE);
	}

		
	if(m_ed4flg)
		m_ed4.EnableWindow(TRUE);
	else
		m_ed4.EnableWindow(FALSE);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CValuSet::OnRadio4() 
{
	m_ed1.EnableWindow(TRUE);
	m_ed2.EnableWindow(TRUE);
	if(m_ed4flg)
		m_ed4.EnableWindow(TRUE);
	else
		m_ed4.EnableWindow(FALSE);
	
	
}

void CValuSet::OnRadio1() 
{
	
	m_ed1.EnableWindow(FALSE);
	m_ed2.EnableWindow(FALSE);
	if(m_ed4flg)
		m_ed4.EnableWindow(TRUE);
	else
		m_ed4.EnableWindow(FALSE);
	
	
}

void CValuSet::OnRadio2() 
{

	m_ed1.EnableWindow(FALSE);
	m_ed2.EnableWindow(FALSE);
	if(m_ed4flg)
		m_ed4.EnableWindow(TRUE);
	else
		m_ed4.EnableWindow(FALSE);
	
	
}

void CValuSet::OnRadio3() 
{
	
	m_ed1.EnableWindow(FALSE);
	m_ed2.EnableWindow(FALSE);
	if(m_ed4flg)
		m_ed4.EnableWindow(TRUE);
	else
		m_ed4.EnableWindow(FALSE);
	
	
}
